#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 4e4 + 5;
const int MX = 4e4;
int n, m;
int np[N], phi[N];
vector<int> primes;
void init(int n) {
  np[1] = 1;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!np[i]) {
      primes.push_back(i);
      phi[i] = i - 1;
    }
    for (int j : primes) {
      int k = j * i;
      if (k > n) break;
      np[k] = 1;
      if (i % j == 0) {
        phi[k] = phi[i] * j;
        break;
      } else
        phi[k] = phi[i] * (j - 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  if (n == 2) {
    cout << 3;
    return 0;
  }
  ll sum = 3;
  n -= 1;
  init(n);
  rep(i, 2, n) sum += 2 * phi[i];
  cout << sum;
  return 0;
}